<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>商品管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
		});
	
		function form(){
			$("#inputForm").attr("action","${ctx}/product/product/genProduct/form");
			$("#inputForm").submit();
		}
		function parameter() {
			$("#inputForm").attr("action","${ctx}/product/product/genProduct/parameter");
			$("#inputForm").submit();
		}
		function picture() {
			$("#inputForm").attr("action","${ctx}/product/product/genProduct/picture");
			$("#inputForm").submit();
		}
		function associate() {
			$("#inputForm").attr("action","${ctx}/product/product/genProduct/gif");
			$("#inputForm").submit();
		}
		function detail() {
			$("#inputForm").attr("action","${ctx}/product/product/genProduct/detail");
			$("#inputForm").submit();
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li ><a href="#" onclick="form();">基本信息</a></li>
		<li ><a href="#" onclick="detail();">介绍</a></li>
		<li ><a href="#" onclick="picture();">商品图片</a></li>
		<li ><a href="#" onclick="parameter();">商品参数</a></li>
		<li class="active"><a href="#" onclick="associate();">关联</a></li>
	</ul><br/>
	<spring:htmlEscape defaultHtmlEscape="true" />
	<form:form id="inputForm" modelAttribute="genProduct" action="${ctx}/product/product/genProduct/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="catalogid"/>
		<form:hidden path="name"/>
		<form:hidden path="introduce"/>
		<form:hidden path="code"/>
		<form:hidden path="brand"/>
		<form:hidden path="nowprice"/>
		<form:hidden path="stock"/>
		<form:hidden path="score"/>
		<form:hidden path="maxpicture"/>
		<form:hidden path="images"/>
		<form:hidden path="producthtml" id="producthtml" htmlEscape="true" />
		<form:hidden path="detail" id="detail" htmlEscape="true" /> 
		<form:hidden path="isnew"/>
		<form:hidden path="isrecommend"/>
		<form:hidden path="order1"/>
		<form:select path="associateStr" multiple="multiple" cssStyle="width:275px;">
			<c:forEach items="${products }" var="product">
				<c:if test="${genProduct.associateStr.contains(product.id) }">
					<form:option value="${product.id }" selected="selected">${product.name }</form:option>
				</c:if>
				<c:if test="${!genProduct.associateStr.contains(product.id) }">
					<form:option value="${product.id }">${product.name }</form:option>
				</c:if>
			</c:forEach>
		</form:select>
		<div class="form-actions">
			<input id="btnSubmitAssociateStr" class="btn btn-primary" type="button" value="保 存"/>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
	<script type="text/javascript">
		$('#btnSubmitAssociateStr').click(function (){
			$("#inputForm").submit();
		})
	</script>
</body>
</html>